package test;

public class exam06 {
    public static void main(String[] args) {
        AnimaL[] animals = new AnimaL[3];

        animals[0] = new Bird();
        animals[1] = new DOg();
        animals[2] = new Fish();

        for (AnimaL animal : animals) {
            animal.play();
        }
    }
}

abstract class AnimaL {
    public abstract void play();
}

class Bird extends AnimaL {
    @Override
    public void play() {
        System.out.println("鸟在天上飞");
    }
}

class DOg extends AnimaL {
    @Override
    public void play() {
        System.out.println("狗在地上跑");
    }
}

class Fish extends AnimaL {
    @Override
    public void play() {
        System.out.println("鱼在水里游");
    }
}
